package com.dtf.admin.manage.web;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dtf.admin.common.utils.CacheUtils;
import com.dtf.admin.manage.service.SysStaffBo;
import com.dtf.admin.manage.vo.SysStaff;

@RequestMapping(value="/RedisController")
@RestController
public class RedisController {
	
	@Autowired
	private SysStaffBo sysStaffBo;
	
	@RequestMapping(value="/findSysStaffVo/{staff_id}")
	public SysStaff findSysStaffVo(@PathVariable String staff_id){
		Map param = new HashMap();
		param.put("staff_id", staff_id);
		SysStaff staff = CacheUtils.getInst().get(staff_id);
		if (staff == null) {
			System.out.println("从数据库获取数据");
			staff = sysStaffBo.findSysStaffVo(param);
			CacheUtils.getInst().set(staff_id, staff, 30);
		}
		return staff;
	}
	
}
